package cn.z2huo.demo.spring.cloud.alibaba.consumer.controller.user;

import cn.z2huo.demo.spring.cloud.alibaba.provider.api.user.UserClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>调用服务提供者的 UserController 接口
 *
 * @author z2huo
 */
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
@Slf4j
public class UserController {

    private final UserClient userClient;

    @GetMapping("/getUserNameByCode")
    public String getUserNameByCode(String userCode) {
        log.info("consumer /user/getUserNameByCode userCode is {}", userCode);
        return userClient.getUserNameByCode(userCode);
    }

}
